﻿#ifndef DIRHELPER_H
#define DIRHELPER_H

#include <QObject>

class DirHelper : public QObject
{
    Q_OBJECT
public:
    static DirHelper *getInstance();
    static QString toPlatformPath(const QString &path);

    Q_INVOKABLE QString configPath();
    Q_INVOKABLE QString logPath();

    Q_INVOKABLE QString dumpPath();
    Q_INVOKABLE QString downloadPath();
    Q_INVOKABLE QString updatePath();
    Q_INVOKABLE QString getAppPath();

    Q_INVOKABLE bool changeDirPath(const QString &path);
    Q_INVOKABLE QString getCurrentDirPath() const;
    Q_INVOKABLE void resetMainPath();

private:
    explicit DirHelper(QObject *parent = nullptr);

    void createDir();

    QString m_mainPath;

    const char *log = "log";
    const char *config = "config";
    const char *dump = "dump";

    const char *download="download";
    const char *update="update";

    static DirHelper * m_instance;
};

#endif // DIRHELPER_H
